<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<style type="text/css">
.login_bnt {
	width: 211px;
	height: 42px;
	background: url(images/background/loginbnt.gif) no-repeat;
	margin: 30px auto;
	cursor: pointer;
}

</style>

</head>
<body>
<FORM id=loginFormId method=post action="">
<input type="hidden" id="sysType" name="vo.sysType" value=""/>
			<ul>
					<li>用户名：<input type="text" name="vo.username" id="j_username"/></li>
					<li>密&nbsp;&nbsp;码：<input type="password" name="vo.password" id="j_password" onkeydown="keyDown(event)"/></li>
				</ul>
		<input type="button" id="btnSubmit" value="登录" onclick="loginFB();"/>
</FORM>
</body>
<script type="text/javascript">
document.getElementById("sysType").value = parent.document.getElementById("sysType").value;
document.getElementById("j_username").value = parent.document.getElementById("username").value;
function loginFB(){
	var arr = document.getElementById("loginFormId").getElementsByTagName("input");
	var data = "";
	for(var i=0;i<arr.length;i++){
		if(arr[i].type=='hidden'||arr[i].type=='text'||arr[i].type=='password'){
			data += arr[i].name+"="+arr[i].value;
				data += '&';
		}
	}
	data = data.substring(0,data.length-1);

	parent.ajaxSubmit(parent.document.getElementById("fbContextPath").value+"/help/topic/login.action",data,loginSuccess,loginError);
}

function loginSuccess(msg){
	if(msg!=1){
		alert(msg);
	}else{
		alert('账号：'+document.getElementById("j_username").value + ' 成功登录。');
		parent.document.getElementById("loginIn").setAttribute("style", "");
		parent.document.getElementById("loginOut").setAttribute("style", "display:none");
		parent.document.getElementById("loginA2").innerHTML = document.getElementById("j_username").value;	
		parent.document.getElementById("username").value = document.getElementById("j_username").value;
		parent.closePop();
	}
}

function loginError(msg){
	alert('登录失败');
}

/**
 * 按回车键时，触发登录按钮
 */
function keyDown(e){
	var ev =window.event||e; 
 	//按回车键
  	if (ev.keyCode==13) {
   		ev.returnValue=false;
   		ev.cancel = true;
   		var sub =  document.getElementById("btnSubmit");
  		sub.click();
  	} 
}

</script>
</html>